package cn.wolfcode.wolf2w.common.redis.util;

import lombok.Getter;

@Getter
public enum RedisKeys {
    //这是网关过滤器的缓存key
    BRUSH("brush",30),

    NOTE_STATIS_HASH("note_statis_hash",-1l),
    USER_NOTE_FAVOR("user_note_favor",-1),
    USER_NOTE_THUMBSUP("user_note_thumbsup",-1),


    USER_STRATEGY_THUMBSUP("user_strategy_thumbsup",-1),
    USER_STRATEGY_FAVOR("user_strategy_favor:",-1),
    STRATEGY_STATIS_HASH("strategy_statis_hash",-1l),

    VERIFY_CODE("verify_code:", 60 * 5);

    //key的前缀
    private String prefix;
    //key的过期时间
    private long time;

    private RedisKeys(String prefix, long time) {
        this.prefix = prefix;
        this.time = time;
    }

    public String join(String... value){
        StringBuffer sb = new StringBuffer();
        sb.append(this.prefix);
        for (String string : value) {
            sb.append(":").append(string);
        }
        return sb.toString();
    }

}
